<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<%--
  Created by IntelliJ IDEA.
  User: wu
  Date: 2018/4/16
  Time: 20:53
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <title>Title</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/bootstrap.min.css">
    <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
    <script src="${pageContext.request.contextPath}/static/jquery.min.js"></script>
    <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
    <script src="${pageContext.request.contextPath}/static/bootstrap.min.js"></script>
</head>
<body>
<%--评论管理列表，可删除评论，管理员权限--%>
<div class="container-fluid" style="margin: 20px;">
    <div class="row-fluid">

        <form class="form-inline" role="form" action="/comment/findByComment" method="post">
            <div class="form-group">
                <input type="text" class="form-control" id="name" name="commentId"placeholder="请输入编号">
            </div>
            <div class="form-group">
                <input type="text" class="form-control" id="name1" name="content" placeholder="请输入评论内容">
            </div>
            <div class="form-group">
                <input type="text" class="form-control" id="parentType" name="parentType" placeholder="请输入评论类型">
            </div>
            <button type="submit" class="btn btn-default">索搜</button>
        </form>
        <button type="submit" class="btn btn-default"><a href="/view/addAndUpdateComment.jsp?isUpdate=false">添加</a></button>
        <hr>
        <div class="span12">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="70px">
                        编号
                    </th>
                    <th>
                        评论内容
                    </th>
                    <th width="200px">
                        状态
                    </th>
                    <th width="200px">
                        类型
                    </th>
                    <th width="220px">
                        操作
                    </th>

                </tr>
                </thead>
                <tbody>
                <c:forEach var="comment" items="${commentList}">
                    <tr>
                        <td>
                                ${comment.commentId}
                        </td>
                        <td>
                                ${comment.content}
                        </td>
                        <td>
                                ${comment.status}
                        </td>
                        <td>
                                ${comment.parentType}
                        </td>
                        <td>
                            <nav aria-label="Page navigation">
                                <ul class="pagination">
                                    <li>
                                        <a href="${pageContext.request.contextPath}/comment/deleteComment?currentPage=1&pageSize=5&commentId=${comment.commentId}"
                                           aria-label="Previous">
                                            <span aria-hidden="true">删除</span>
                                        </a>
                                    </li>
                                    <li>
                                        <a href="/comment/getComment?commentId=${comment.commentId}" aria-label="Next">
                                            <span aria-hidden="true">修改</span>
                                        </a>
                                    </li>
                                </ul>
                            </nav>

                        </td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>


            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li>
                        <a href="${pageContext.request.contextPath}/comment/getAllComment?currentPage=${pageUtil.currentPage-1}&pageSize=${pageUtil.pageSize}"
                           aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <c:forEach var="page" begin="1" end="${pageUtil.totalPage}">
                        <li>
                            <a href="${pageContext.request.contextPath}/comment/getAllComment?currentPage=${page}&pageSize=${pageUtil.pageSize}">${page}</a>
                        </li>
                    </c:forEach>
                    <li>
                        <a href="${pageContext.request.contextPath}/comment/getAllComment?currentPage=${pageUtil.currentPage+1}&pageSize=${pageUtil.pageSize}"
                           aria-label="Next">
                            <span aria-hidden="true" onclick="page(${pageUtil.currentPage+1},${pageUtil.pageSize})">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>

        </div>
    </div>
</div>
</body>
</html>
